package Work1;

import java.util.Scanner;

public class Work1 {
    public static void main(String[] args) {
        Account account = new Account(500);
        AccountOperate accountOperate = new AccountOperate(account);

        System.out.println("请选择你的操作: 取钱 or 存钱");

        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String scan = scanner.next();

            if (scan.equals("存钱")) {
                System.out.println("当前余额为" + account.getMoney() + ",请输入要取的数目:");
                double money = scanner.nextDouble();
                accountOperate.saving(money);
                System.out.println("存入" + money + "元后,您的余额为:" + account.getMoney());
            } else if (scan.equals("取钱")) {
                System.out.println("请输入要存入的数目:");
                double money = scanner.nextDouble();
                accountOperate.withDraw(money);
                System.out.println("取款" + money + "元后,您的余额为:" + account.getMoney());
            } else {
                System.out.println("输入错误!");
            }
        }

    }
}
